According to a video compression standard H.264/MPEG-4 advanced video coding (AVC), a picture is divided into macroblocks for video encoding. After each of the macroblocks is encoded in all encoding modes available in interprediction and intraprediction, an appropriate encoding mode is selected according to bit rates required for encoding of the macroblock and rate-distortion (RD) costs between the original macroblock and a decoded macroblock, and the macroblock is encoded in the selected encoding mode.
In intraprediction, a prediction value of a macroblock to be encoded is calculated using a pixel value of a pixel that is spatially adjacent to the macroblock to be encoded and a difference between the prediction value and the pixel value is encoded, instead of referring to reference pictures, in order to encode macroblocks of a current picture. Modes used in intraprediction are divided into 4×4 intraprediction modes, 8×8 intraprediction modes (in case of a high profile), and 16×16 intraprediction modes.
FIG. 1 illustrates 16×16 intraprediction modes according to H.264, and FIG. 2 illustrates 4×4 intraprediction modes according to H.264.
Referring to FIG. 1, the 16×16 intraprediction modes include a total of 4 modes, i.e., a vertical mode, a horizontal mode, a direct current (DC) mode, and a plane mode. Referring to FIG. 2, the 4×4 intraprediction modes include a total of 9 modes, i.e. a vertical mode, a horizontal mode, a DC mode, a diagonal down-left mode, a diagonal down-right mode, a vertical-right mode, a vertical-left mode, a horizontal-up mode, and a horizontal-down mode.
For example, when a current 4×4 block is predicted according to a mode 0, i.e., the vertical mode of FIG. 2, pixel values of pixels A through D adjacent and above the current 4×4 block are used as pixel values of the current 4×4 block. In other words, the pixel value of the pixel A is used as pixel values of four pixels included in the first column of the current 4×4 block, the pixel value of the pixel B is used as pixel values of four pixels included in the second column of the current 4×4 block, the pixel value of the pixel C is used as pixel values of four pixels included in the third column of the current 4×4 block, and the pixel value of the pixel D is used as pixel values of four pixels included in the fourth column of the current 4×4 block. Next, a difference between the pixel values of pixels of the current 4×4 block predicted using the pixels A through D, and the actual pixel values of pixels included in the original current 4×4 block is obtained and encoded.
In video encoding according to H.264, a current macroblock is encoded in a total of 13 modes including the 4×4 intraprediction modes and the 16×16 intraprediction modes, and is then intraprediction encoded in an encoding mode having the smallest cost. More specifically, the current macroblock is intrapredicted in the four 16×16 intraprediction modes and one having the smallest cost is selected from the 16×16 intraprediction modes. Each of 4×4 sub-blocks of the current macroblock is intrapredicted in the nine 4×4 intraprediction modes and one having the smallest cost is selected for each sub-block from the 4×4 intraprediction modes. The cost of the selected 16×16 intraprediction mode and a sum of the costs of the selected 4×4 intraprediction modes are compared and a mode having the smallest cost is selected.
However, according to prior art, when pixels referred to in intraprediction have a large difference from actual pixels of a current block to be intrapredicted, a residue increases, resulting in inefficient prediction. In other words, according to prior art, since intraprediction is performed only using pixel values of pixels adjacent above and on the left side of a current block to be intrapredicted, an improved encoding method which improves encoding efficiency is required.